package com.xdf.ecommerce.service;

import com.xdf.ecommerce.vo.UsernameAndPassword;

import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.spec.InvalidKeySpecException;

/**
 * @author chanchaw
 * @create 2025-10-16 7:41
 */
public interface JWTService {
    // 使用默认的token过期时间
    String generateToken(String username,String passwrod) throws NoSuchAlgorithmException, IOException, InvalidKeySpecException;
    // 可以自定义token的过期时间
    String generateToken(String username,String password,int expire) throws NoSuchAlgorithmException, IOException, InvalidKeySpecException;
    // 注册并立即创建token并返回
    String registerAndGetToken(UsernameAndPassword usernameAndPassword) throws NoSuchAlgorithmException, IOException, InvalidKeySpecException;
    PrivateKey getPrivateKey() throws NoSuchAlgorithmException, IOException, InvalidKeySpecException;
}
